Feature/scheduler#7
Conversation
- Add a Scheduler to get access to the task list - Refactor service registration - Remove old sample - Add new sample - Add EditorConfig - Add Possibility to add Task at Runtime +semver: major
- Cancel Delay in Hosted Service done right 🤔 Co-authored-by: Paule <Paul-Jeschke@outlook.com>
|
Maybe @jphilipps has time for a review? 😁 |
| _ = stoppingToken.Register(() => this.logger.LogDebug("Runtime Sample Task forced stopping.")); | ||
|
|
||
| var runCount = 0; | ||
| while (runCount < 5) |
There was a problem hiding this comment.
Personally, I'd prefer a for-loop, but i assume thats a matter of style.
There was a problem hiding this comment.
good point, I will change this.
|
|
||
| public class IndexModel : PageModel | ||
| { | ||
| private readonly ILogger<RuntimeSampleTask> runtimeSampleTaskLogger; |
There was a problem hiding this comment.
Also matter of preference but: since almost all classes only have one logger, I call them all the same: "logger". I only call them differently if there are different loggers in a given class to make myself and others aware that this might not be the logger one wants to use. Also, the shorter name might allow you to put the parameters in lines 22ff on a single line.
There was a problem hiding this comment.
That's a good point, I will change that.
|
|
||
| public void AddTask(IScheduledTask scheduledTask) | ||
| { | ||
| var taskName = string.IsNullOrWhiteSpace(scheduledTask.Options.Name) ? Guid.NewGuid().ToString() : scheduledTask.Options.Name; |
There was a problem hiding this comment.
Many other lines have been broken before (which I think is optional), but in this case I guess it makes a lot of sense:
var taskName = string.IsNullOrWhiteSpace(scheduledTask.Options.Name)
? Guid.NewGuid().ToString()
: scheduledTask.Options.Name;
Of cause, I’ll take a look as soon as I can. |
| { | ||
| "sdk": { | ||
| "version": "2.2.105" | ||
| "version": "2.2.401" |
| ProjectFolder: "$(Build.SourcesDirectory)/src/KK.DotNet.BackgroundTasks.Scheduled" | ||
| DotNetVersion: "2.2.105" | ||
| GitVersion: "4.0.1-beta1-62" | ||
| DotNetVersion: "2.2.401" |
There was a problem hiding this comment.
Use the new SDK from global.json
| _ = stoppingToken.Register(() => this.logger.LogDebug("Runtime Sample Task forced stopping.")); | ||
|
|
||
| var runCount = 0; | ||
| while (runCount < 5) |
There was a problem hiding this comment.
good point, I will change this.
Addin task on runtime will be possible with this PR
this should close #2 #5